//
//  HZGoodsCategoryColSecHeadView.m
//  app
//
//  Created by 刘华舟 on 15/5/21.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//

#import "HZGoodsCategoryColSecHeadView.h"

#import "HZCollectionView.h"

static const NSInteger kGoodsCategoryColMargin = 24;

@interface HZGoodsCategoryColSecHeadView()

@property (strong, nonatomic) UILabel *nameLabel;

@end

@implementation HZGoodsCategoryColSecHeadView

+ (instancetype)cellWithCollectionView:(HZCollectionView *)collectionView dequeueReusableSupplementaryViewOfKind:(NSString*)elementKind forIndexPath:(NSIndexPath *)indexPath{
    NSString *cellReuseIdentifier = @"HZGoodsCategoryColSecHeadView";
    HZGoodsCategoryColSecHeadView * header= (HZGoodsCategoryColSecHeadView *)[collectionView dequeueReusableSupplementaryViewOfKind:elementKind withReuseIdentifier:cellReuseIdentifier forIndexPath:indexPath];
    if (header == nil) {
        NSLog(@"创建HZGoodsCategoryColSecHeadView失败");
    }
    return header;
}

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.ubo.height = [self.ubo uh:kGoodsCategoryColSecHeadViewHeight];
        self.backgroundColor = HZ_CLEAR_COLOR;
        
        self.nameLabel = [[UILabel alloc] initWithFrame:CGRectOf([self.ubo fx:UB_LEFT ux:kGoodsCategoryColMargin fy:UB_TOP],
                                                                 [self.ubo fw:UB_WIDTH uw:-2*kGoodsCategoryColMargin fh:UB_HEIGHT])];
        [self.nameLabel setTextColor:HZ_MALL_TEXT_S_LIGHTGRAY_COLOR];
        self.nameLabel.textAlignment = NSTextAlignmentLeft;
        [self.nameLabel setFont:kHZFont_Content_S];
        [self addSubview:self.nameLabel];
    }
    return self;
}

-(void)showGoodsCategoryName:(NSString *)name{
    self.nameLabel.text = name;
}

@end
